import { readFile } from 'node:fs/promises'
import lincy from '@lincy/eslint-config'

const autoImport = JSON.parse(
    (await readFile(new URL('./.eslintrc-auto-import.json', import.meta.url))).toString(),
)

const config = lincy(
    {
        unocss: true,
        formatters: {
            css: true,
            graphql: true,
            html: true,
            markdown: true,
        },
        pnpm: false,
        toml: false,
        overrides: {
            ignores: [
                '**/static',
                '**/uni-app-types.d.ts',
            ],
        },
    },
    {
        languageOptions: {
            globals: {
                ...autoImport.globals,
                uni: 'readonly',
                UniNamespace: 'readonly',
                Objable: 'readonly',
                NodeJS: 'readonly',
                AnyFn: 'readonly',
                ResponseData: 'readonly',
                ApiType: 'readonly',
                Nullable: 'readonly',
                App: 'readonly',
                Page: 'readonly',
            },
        },
        rules: {
            'no-undef': ['error', { 'typeof': true }],
            'no-unused-vars': 'off',
            'vue/attributes-order': 'off',
            'vue/require-v-for-key': 'off',
            'vue/no-use-v-if-with-v-for': 'off',
            'vue/valid-v-for': 'off',
            'vue/no-parsing-error': 'off',
            'vue/no-dupe-keys': 'off',
            'vue/no-unused-components': 'off',
            'vue/no-unused-vars': 'off',
            'vue/html-indent': 'off',
            'vue/no-side-effects-in-computed-properties': 'off',
            'vue/return-in-computed-property': 'off',
            'vue/require-valid-default-prop': 'off',
            'vue/require-prop-type-constructor': 'off',
            'vue/component-name-in-template-camel-case': 'off',
            'style/semi': 'off',
            'style/comma-dangle': 'off',
            'style/indent': 'off',
            'style/eol-last': 'off',
            'style/quotes': 'off',
            'style/quote-props': 'off',
            'style/space-before-blocks': 'off',
            'style/member-delimiter-style': 'off',
            'style/no-multiple-empty-lines': 'off',
            'ts/method-signature-style': 'off',
            'ts/no-unused-vars': 'off',
            'jsonc/comma-dangle': 'off',
            'unicorn/prefer-at': 'off',
            'regexp/no-unused-capturing-group': 'off',
            'no-cond-assign': 'off',
            'perfectionist/sort-imports': 'off',
            'import/newline-after-import': 'off',

        }
    },
)


export default config
